// 重写antd样式

:root {
  --ant-border-radius: 4px;
  --ant-height-base: 28px;
}

// tab配高
.ant-tabs-tab {
  padding: 10px 0;
}

.ant-layout {
  background: #f5f5f5;
}

.ant-select-selection-item {
  color: var(--fok-text-color-1);
}
// 下拉框
.ant-cascader-menu-item,
.ant-select-item {
  margin: 0 6px;
  padding: 5px 6px;
  border-radius: var(--ant-border-radius);
  color: var(--fok-text-color-1);
  &.ant-cascader-menu-item-active:not(.ant-cascader-menu-item-disabled),
  &.ant-select-item-option-selected:not(.ant-select-item-option-disabled) {
    font-weight: 400;
    color: var(--ant-primary-color);
    background-color: var(--fok-color-selected);
  }
}

.ant-cascader-menu-item-active {
  .ant-cascader-menu-item-content {
    color: var(--ant-primary-color);
    font-weight: normal;
  }
}

.ant-select-tree .ant-select-tree-node-content-wrapper:hover {
  background: var(--fok-color-selected) !important;
}
.ant-select-tree-treenode.ant-select-tree-treenode-selected {
  .ant-select-tree-node-selected {
    background: var(--fok-color-selected) !important;
  }
}

// 消息提示
.ant-message {
  z-index: 999999;
}

.ant-radio-button-wrapper.ant-radio-button-wrapper-checked {
  box-shadow: none !important;
}

.left-radius {
  border-top-left-radius: 24px !important;
  border-bottom-left-radius: 24px !important;
}
.right-radius {
  border-top-right-radius: 24px !important;
  border-bottom-right-radius: 24px !important;
}

// 日期范围选择器
.ant-picker-dropdown-range {
  .ant-picker-panel {
    border: none;
  }

  div.ant-picker-cell-inner {
    border-radius: 24px !important;
    &::before {
      border: none !important;
      background: none !important;
    }
  }

  // 已选择范围cell的背景色，无 hover 样式
  .ant-picker-cell-in-range {
    div.ant-picker-cell-inner {
      &::after {
        background: #e5f3f2 !important;
      }
    }
  }

  // 清除在hover 的范围中cell边框效果
  .ant-picker-cell-range-hover-end,
  .ant-picker-cell-range-hover-start,
  .ant-picker-cell-range-hover {
    &::after {
      border: none !important;
    }
  }

  // 选中范围的前后cell 背景色
  .ant-picker-cell-range-hover-start,
  .ant-picker-cell-range-start,
  .ant-picker-cell-range-end {
    &::before {
      background: #e5f3f2 !important;
    }
  }
  .ant-picker-cell-range-hover-start {
    &::before {
      left: 50%;
    }
  }

  // hover范围end-cell样式覆盖，排除已选择范围的hover
  .ant-picker-cell-range-hover-end:not(.ant-picker-cell-in-range) {
    &::before {
      right: 50% !important;
      border-top-right-radius: 24px !important;
      border-bottom-right-radius: 24px !important;
      background: #e5f3f2 !important;
    }
  }

  // 已选范围，或者hover范围的字体颜色，背景色圆角设置
  .ant-picker-cell-in-range,
  .ant-picker-cell-range-hover:not(.ant-picker-cell-selected) {
    .ant-picker-cell-inner {
      color: #0da59a !important;
    }
    &::before {
      background: #e5f3f2 !important;
    }
    &:first-child {
      &::before {
        @extend .left-radius;
      }
    }
    &:last-child {
      &::before {
        @extend .right-radius;
      }
    }
  }

  // 对于已选中的范围，在此hover超出范围时清除right，避免背景色断层
  .ant-picker-cell-in-range.ant-picker-cell-range-hover-start,
  .ant-picker-cell-range-hover {
    &::before {
      left: 0 !important;
      right: 0 !important;
    }
  }

  .ant-picker-cell-range-hover-start:not(.ant-picker-cell-in-range),
  .ant-picker-cell-range-hover-end:not(.ant-picker-cell-in-range) {
    .ant-picker-cell-inner {
      background: var(--fok-color-brand-10) !important;
      color: #ffffff !important;
    }
  }

  .ant-picker-cell-disabled:first-child {
    &::before {
      @extend .left-radius;
    }
  }
  .ant-picker-cell-disabled:last-child {
    &::before {
      @extend .right-radius;
    }
  }

  .ant-picker-cell-today:not(
      .ant-picker-cell-selected,
      .ant-picker-cell-range-start,
      .ant-picker-cell-range-end
    ) {
    .ant-picker-cell-inner {
      color: var(--fok-color-brand-10) !important;
    }
    &::after {
      display: block;
      content: '';
      width: 4px;
      height: 4px;
      border-radius: 4px;
      background: var(--fok-color-brand-10);
      left: 50%;
      margin-left: -2px;
      position: absolute;
      bottom: 2px;
    }
  }
}

// 日期选择器
.ant-picker-dropdown {
  .ant-picker-cell-selected {
    .ant-picker-cell-inner {
      border-radius: 36px !important;
      border: none;
      &::before {
        border: none !important;
      }
    }
  }

  .ant-picker-cell-range-start-single,
  .ant-picker-cell-range-end-single {
    &::before {
      background: none !important;
    }
  }

  .ant-picker-cell-today:not(
      .ant-picker-cell-selected,
      .ant-picker-cell-range-end,
      .ant-picker-cell-range-start
    ) {
    .ant-picker-cell-inner {
      color: var(--fok-color-brand-10) !important;
      &::before {
        border: none !important;
      }

      &::after {
        display: block;
        content: '';
        width: 4px;
        height: 4px;
        border-radius: 4px;
        background: var(--fok-color-brand-10);
        left: 50%;
        margin-left: -2px;
        position: absolute;
        bottom: 0px;
      }
    }
  }

  .ant-picker-cell {
    &:hover {
      .ant-picker-cell-inner {
        border-radius: 24px !important;
      }
    }
  }
}

.ant-picker-time-panel-cell.ant-picker-time-panel-cell-selected {
  background: var(--fok-color-selected);
}

// 输入框高度
.ant-input-affix-wrapper:not(.ant-input-affix-wrapper-lg) {
  height: var(--ant-height-base);
}
.ant-input-affix-wrapper.ant-input-affix-wrapper-textarea-with-clear-btn {
  height: auto;
}

// 搜索框高度
.ant-input-search {
  .ant-input {
    height: var(--ant-height-base);
    line-height: var(--ant-height-base);
  }
  .ant-input-affix-wrapper {
    .ant-input {
      height: initial;
      line-height: initial;
    }
  }
}

// 按钮+图标样式
.ant-btn > .iconfont + span,
.ant-btn > span + .iconfont {
  margin-left: 4px;
}

// input - close 不显示的时候直接隐藏掉
.anticon.anticon-close-circle.ant-input-clear-icon-hidden {
  display: none;
}

// 交换下按钮位置
.ant-popover.ant-popconfirm {
  .ant-popover-buttons {
    display: flex;
    flex-flow: row-reverse;
  }
}

// disabled 文本显示黑色
.fok-wang-editor-content.disabled .w-e-text,
.ant-picker-input > input[disabled],
.ant-select-disabled.ant-select:not(.ant-select-customize-input) .ant-select-selector input,
.ant-select-disabled.ant-select:not(.ant-select-customize-input)
  .ant-select-selector
  .ant-select-selection-item,
input.ant-input.ant-input-disabled {
  color: var(--fok-color-gray-12);
  user-select: auto;
}

.fok-date-range-time-picker {
  .ant-picker-datetime-panel {
    padding-bottom: 40px;
    .ant-picker-date-panel,
    .ant-picker-time-panel {
      border-bottom: 1px solid #f0f0f0;
    }
  }

  .ant-picker-footer-extra,
  .ant-picker-footer {
    border-bottom: 0 !important;
  }

  .ant-picker-ranges {
    position: absolute;
    bottom: 5px;
    right: 0;
  }
}

// 表单校验错误提示
.ant-form-item-has-error {
  .fok-tag {
    color: var(--ant-error-color);
    background: var(--ant-error-color-deprecated-bg);
    border-color: var(--ant-error-color-deprecated-border);
  }
}